﻿Public Class ViewParametrerReassurance

    Private Sub ClesChoisiesDgrid_AutoGeneratingColumn(sender As Object, e As Windows.Controls.DataGridAutoGeneratingColumnEventArgs) Handles ClesChoisiesDgrid.AutoGeneratingColumn
        e.Cancel = Not (e.PropertyName.ToLower() = "groupe" Or e.PropertyName.ToLower() = "code_garantie" Or e.PropertyName.ToLower() = "generation")

    End Sub

    'Private Sub modelreassDgrid_RowEditEnding(sender As Object, e As Windows.Controls.DataGridRowEditEndingEventArgs) Handles modelreassDgrid.RowEditEnding
    '    If e.EditAction = Windows.Controls.DataGridEditAction.Commit Then

    '        Dim dview As DataView = ClesChoisiesDgrid.ItemsSource

    '        If dview.Count > 0 Then

    '            Dim mdlrow As DataModel.PmtDataset.ModeleReassuranceRow = CType(e.Row.Item, DataRowView).Row

    '            For Each r As DataRowView In dview

    '                Dim reassrow As DataModel.PmtDataset.ReassuranceRow = r.Row

    '                If reassrow.Quote_Part_Coass <> mdlrow.Quote_Part_Coass Then
    '                    reassrow.Quote_Part_Coass = mdlrow.Quote_Part_Coass
    '                End If

    '                If reassrow.Quote_Part_Reass <> mdlrow.Quote_Part_Reass Then
    '                    reassrow.Quote_Part_Reass = mdlrow.Quote_Part_Reass
    '                End If

    '                If reassrow.Taux_Com_Reass <> mdlrow.Taux_Com_Reass Then
    '                    reassrow.Taux_Com_Reass = mdlrow.Taux_Com_Reass
    '                End If

    '                If reassrow.Taux_Produit_Financier <> mdlrow.Taux_Produit_Financier Then
    '                    reassrow.Taux_Produit_Financier = mdlrow.Taux_Produit_Financier
    '                End If

    '                If reassrow.Exclure_SelectionMedicale <> mdlrow.Exclure_SelectionMedicale Then
    '                    reassrow.Exclure_SelectionMedicale = mdlrow.Exclure_SelectionMedicale
    '                End If

    '            Next

    '        End If
    '    End If
    'End Sub

    Private Sub modelreassDgrid_CellEditEnding(sender As Object, e As Windows.Controls.DataGridCellEditEndingEventArgs) Handles modelreassDgrid.CellEditEnding
        If e.EditAction = Windows.Controls.DataGridEditAction.Commit Then

            Dim dview As DataView = ClesChoisiesDgrid.ItemsSource

            If dview.Count > 0 And e.Column.Header.ToString().ToLower() <> "nom" Then
                For Each r As DataRowView In dview
                    r(e.Column.Header.ToString()) = CType(e.EditingElement, Windows.Controls.TextBox).Text
                Next
            End If

        End If
    End Sub
End Class
